package hikari.pathfind.data.editor;

/**
 * @author Dmitry
 */
public class IndexPair {
    private int index1;
    private int index2;

    public IndexPair(int index1, int index2) {
        if (index1 < index2) {
            this.index1 = index1;
            this.index2 = index2;
        } else {
            this.index1 = index2;
            this.index2 = index1;
        }
    }

    public int getIndex1() {
        return index1;
    }

    public void setIndex1(int index1) {
        this.index1 = index1;
    }

    public int getIndex2() {
        return index2;
    }

    public void setIndex2(int index2) {
        this.index2 = index2;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 59 * hash + this.index1;
        hash = 59 * hash + this.index2;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final IndexPair other = (IndexPair) obj;
        if (this.index1 != other.index1) {
            return false;
        }
        if (this.index2 != other.index2) {
            return false;
        }
        return true;
    }
    
    @Override
    public String toString() {
        return "[x=" + index1 + ",y=" + index2 + "]";
    }
}
